<template>
  <resource-table
    :table-columns="tableColumns"
    operations="edit,view,delete"
    :operation-column-width="150"
    @queryTable="queryTable"
    @editTableRow="handleEdit"
    @viewTableRow="handleView"
    @deleteTableRow="handleDelete"
  >
    <template #operation>
      <el-tooltip
        effect="dark"
        content="编辑内容"
        placement="top"
        class="col-btn-item"
      >
        <i class="el-icon-edit"></i>
      </el-tooltip>
    </template>
  </resource-table>
</template>

<script>
export default {
  name: "ResourceTableOperationColumn",
  data() {
    return {
      tableColumns: [
        {
          prop: "date",
          label: "日期",
        },
        {
          prop: "name",
          label: "姓名",
        },
        {
          prop: "address",
          label: "地址",
        },
        {
          prop: "money",
          label: "金额",
          align: "right",
        },
      ],
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
          money: 432,
          status: false,
          topping: true,
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄",
          money: 432,
          status: false,
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄",
          money: 432,
          status: false,
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
          money: 432,
          status: true,
        },
      ],
    };
  },
  methods: {
    queryTable: function (queryParameters, callback) {
      callback(this.tableData);
    },
    handleEdit: function (row, callback) {
      console.log(row);
      callback();
    },
    handleView: function (row) {
      console.log(row);
    },
    handleDelete: function (row, callback) {
      console.log(row);
      callback();
    },
  },
};
</script>

<style scoped lang="scss"></style>
